Skip to content

Conversation

@stefanrueger
Copy link
Collaborator

The PR addresses a longstanding issue #774. Rather than using exit(0) the latest git main already uses return LIBAVRDUDE_EXIT, but these return now need to be percolated to the top layer (main.c in the AVRDUDE application), which then should exit(0). Other applications built with libavrdude might want to stop the session without further errors. There is still a smattering of exit(1) in the libavrdude code, but that is for really tricky situations where recovery is neigh impossible, for example when the process has run out of memory. To all intents and purposes this PR fixes #774.

@stefanrueger stefanrueger added the enhancement New feature or request label Apr 25, 2024
@stefanrueger
Copy link
Collaborator Author

With this PR

$ avrdude -qq -P ch340 -c urclock -xshowversion  && echo "OK"
u7.7 w-u-jpr--
OK

Without this PR

$ avrdude -qq -P ch340 -c urclock -xshowversion  || echo "Not OK"
u7.7 w-u-jpr--
avrdude error: unable to read signature data for part ATmega328P, rc=-4
avrdude error: unable to read signature data, rc=-4
        use -F to override this check
Not OK

Above weird output is from a very recent git main, where exit(0) had been replaced with return LIBAVRDUDE_EXIT as an interim measure; this PR now finishes the work needed to remove exit() calls.

@stefanrueger stefanrueger merged commit 74fa943 into avrdudes:main Apr 26, 2024
@stefanrueger stefanrueger deleted the libavrdude_exit branch April 26, 2024 07:45
@mcuee mcuee added this to the AVRDUDE 8.0 milestone Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove all calls to exit(3) from libavrdude library functions

2 participants